﻿<UserControl 
	x:Class="Com.CodePlex.SPC3.SPbAM.View.ServerWorkspaceView"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
	xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
	xmlns:localvm="clr-namespace:Com.CodePlex.SPC3.SPbAM.ViewModel"
	xmlns:localv="clr-namespace:Com.CodePlex.SPC3.SPbAM.View"
	xmlns:localm="clr-namespace:Com.CodePlex.SPC3.SPbAM.Model"
	mc:Ignorable="d"
	d:DesignHeight="300" 
	d:DesignWidth="600">
	<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width=".33*" MinWidth="200" />
            <ColumnDefinition Width="Auto" />
			<ColumnDefinition Width=".66*" MinWidth="200" />
		</Grid.ColumnDefinitions>
		<TreeView Grid.Column="0" HorizontalAlignment="Stretch" Name="treeView1" VerticalAlignment="Stretch" ItemsSource="{Binding Children}" 
				  ContextMenu="{StaticResource ResourceKey=ContextMenu}">
			<TreeView.ItemContainerStyle>
				<Style TargetType="{x:Type TreeViewItem}">
					<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
					<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
					<Setter Property="localv:TreeViewItemBehavior.IsBroughtIntoViewWhenSelected" Value="True" />
					<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_PreviewMouseRightButtonDown"/>
				</Style>
			</TreeView.ItemContainerStyle>
			<TreeView.Resources>
				<HierarchicalDataTemplate DataType="{x:Type localvm:ViewModel}" ItemsSource="{Binding Children}">
					<StackPanel Orientation="Horizontal" ContextMenu="{StaticResource ResourceKey=ContextMenu}">
						<Image Source="{Binding Path=ImageSource}" Height="14" Width="14"></Image>
						<TextBlock Text="{Binding Path=DisplayName}" Margin="5,0" />
					</StackPanel>
				</HierarchicalDataTemplate>
			</TreeView.Resources>
		</TreeView>
        <GridSplitter Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Width="5" Background="#FFBCBCBC"/>
        <Grid Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
                <RowDefinition Height=".50*" MinHeight="100" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height=".50*" MinHeight="100" />
            </Grid.RowDefinitions>
            <ScrollViewer Grid.Row="0" CanContentScroll="True">
                <!-- maybe this instead http://wpg.codeplex.com/ http://www.codeproject.com/KB/WPF/PropertyGridMVVM.aspx -->
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width=".25*" />
                        <ColumnDefinition Width=".75*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="Name"/>
                    <TextBox Grid.Column="1" x:Name="name" BorderThickness="0"/>
                </Grid>
            </ScrollViewer>
            <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" ResizeBehavior="PreviousAndNext" Height="5" Background="#FFBCBCBC"/>
            <!--<ScrollViewer Grid.Row="2" CanContentScroll="True">-->
            <TextBox Grid.Row="2" x:Name="logbox" BorderThickness="0" IsReadOnly="True" Text="{Binding Log}" VerticalScrollBarVisibility="Visible"  />
            <!--</ScrollViewer> -->
		</Grid>
	</Grid>
</UserControl>